#!/usr/bin/env python

class AnyIter(object):
	def __init__(self, data, safe=False):
		self.safe = safe 
		self.iter = iter(data) 

	def __iter__(self):
		return self 

	def next(self, howmany=1):
		retval = [] 
		for eachIter in range(howmany):
			try: 
				retval.append(self.iter.next())
			except StopIteration:
				if self.safe:
					break 
				else:
					raise 
		return retval
